home *** CD-ROM | disk | FTP | other *** search
- global netscapeHandle, iswin95, hd, netObj, gResult, gDDELastErr, currentNetHandler, winId, winsockHandle, tobeonline, sockautolog, curElapsed, netscapePath
-
- on URLClicked theURL
- netObj(mInit)
- if tobeonline = 1 then
- if currentNetHandler <> "NetFeedback()" then
- if not IsNetscapePresent(120) then
- if not iswin95 then
- if not launchwinsock() then
- return
- end if
- end if
- if not launchNetscape() then
- return
- end if
- end if
- end if
- OpenURL(theURL)
- else
- put theURL into field 4002
- copyToClipBoard(cast 4002)
- alert("Hai scelto di non andare online. L'URL Ë stato copiato negli appunti")
- end if
- end
-
- on launchwinsock
- set winsockpath to GetConfigHelper("application", "winsock", hd & "mime.cfg")
- if (winsockpath = EMPTY) or not netObj(mFileExist, winsockpath) then
- set winsockpath to localizeWinsock()
- end if
- if winsockpath = EMPTY then
- return 0
- end if
- set winsockHandle to netObj(mLaunch, winsockpath)
- put winsockHandle
- if (winsockHandle <= 32) and (winsockHandle <> 16) and (winsockHandle <> 8) then
- alert("Non e' stato possibile lanciare il Winsock.")
- return 0
- end if
- if sockautolog then
- netObj(mMinimizeInstance, winsockHandle)
- end if
- return 1
- end
-
- on localizeWinsock
- set winsockpath to AskApplication("Per favore trova l'applicazione Winsock.", "Applicazione Winsock")
- if winsockpath <> EMPTY then
- AddHelper("application", "winsock", winsockpath, hd & "mime.cfg")
- end if
- return winsockpath
- end
-
- on AskApplication alertString, caption
- alert(alertString)
- return netObj(mGetPath, caption, "Applicazioni", "*.EXE")
- end
-
- on launchNetscape
- set netscapePath to GetConfigHelper("application", "netscape", hd & "mime.cfg")
- if (netscapePath = EMPTY) or not netObj(mFileExist, netscapePath) then
- set netscapePath to LocalizeNetscape()
- end if
- if netscapePath = EMPTY then
- return 0
- end if
- set netscapeHandle to netObj(mLaunch, netscapePath)
- if (netscapeHandle <= 32) and (netscapeHandle <> 16) and (netscapeHandle <> 16) then
- alert("Non e' stato possibile lanciare Netscape.")
- return 0
- end if
- return 1
- end
-
- on LocalizeNetscape
- set netscapePath to netObj(mRegPath, "NetscapeMarkup\shell\open")
- set netscapePath to char 1 to length(netscapePath) - 3 of netscapePath
- if (netscapePath = EMPTY) or not netObj(mFileExist, netscapePath) then
- set netscapePath to AskApplication("Per favore trova Netscape Navigator", "Netscape Navigator")
- end if
- if netscapePath <> EMPTY then
- AddHelper("application", "netscape", netscapePath, hd & "mime.cfg")
- end if
- return netscapePath
- end
-
- on WaitConnection theTimeout, theURL
- if the timer > theTimeout then
- set currentNetHandler to EMPTY
- alert("Non Ë stato possibile attivare la comunicazione con Netscape Navigator. Riprova!")
- return
- end if
- set winId to netObj(mGetWinId, 1, 120)
- if gDDELastErr <> "0" then
- return
- end if
- netObj(mTR_Start, 1, theURL, EMPTY, winId, 2, 3000)
- if gDDELastErr <> "0" then
- DDEError("Errore di comunicazione con Netscape Navigator.")
- return
- end if
- netObj(mTR_Start, 1, theURL, EMPTY, winId, 2, 3000)
- if gDDELastErr <> "0" then
- DDEError("Errore di comunicazione con Netscape Navigator.")
- return
- end if
- netObj(mRegURLEcho, 3000)
- if gDDELastErr <> "0" then
- DDEError("Errore di comunicazione con Netscape Navigator.")
- return
- end if
- set currentNetHandler to "NetFeedback()"
- netObj(mActivate, winId, 3000)
- end
-
- on OpenURL theURL
- startTimer()
- set currentNetHandler to "WaitConnection(60*60*2, " & numToChar(34) & theURL & numToChar(34) & ")"
- put currentNetHandler
- end
-
- on IsNetscapePresent theTimeout
- netObj(mGetNumWin, theTimeout)
- if gDDELastErr <> "0" then
- return 0
- end if
- return 1
- end
-
- on DDEError theErrorAlert
- alert(theErrorAlert & " [DDE Error: " & gDDELastErr & "]")
- end
-
- on IsDocument theURL
- set URLLength to length(theURL)
- set position to 0
- repeat with index = 0 to URLLength - 1
- set curChar to char URLLength - index of theURL
- if curChar = "." then
- set position to URLLength - index + 1
- exit repeat
- end if
- end repeat
- if position > 0 then
- if (char position to position + 2 of theURL = "htm") or (char URLLength - 1 of theURL = "/") then
- return 1
- else
- return 0
- end if
- end if
- end
-
- on ExtractWindowTitle theWindowInfo
- set netscID to "Netscape - ["
- set position to offset(netscID, theWindowInfo)
- if position = 0 then
- return EMPTY
- end if
- return char position + length(netscID) to length(theWindowInfo) - 2 of theWindowInfo
- end
-
- on NetFeedback
- if not IsNetscapePresent(120) then
- if gDDELastErr <> "4002" then
- alert("La comunicazione con Netscape Navigator si e' interrotta inaspettatamente.")
- set currentNetHandler to EMPTY
- set the text of field "URLFeedback" to EMPTY
- set the text of field "TitleFeedback" to EMPTY
- return
- end if
- end if
- set curURL to netObj(mTR_GetLastURL, 1, 3000)
- if IsDocument(curURL) and (curURL <> the text of field "URLFeedback") then
- set the text of field "URLFeedback" to curURL
- set the text of field "TitleFeedback" to ExtractWindowTitle(netObj(mGetWinInfo, winId, 3000))
- end if
- end
-
- on CloseNetscape
- netObj(mQuit, 3000)
- if value(gResult) then
- Obj(mQuitInstance, netscapeHandle)
- end if
- if not iswin95 then
- Obj(mQuitInstance, winsockHandle)
- end if
- end
-
- on OpenDN theDNPath
- if IsNetscapePresent(120) then
- OpenURL(theDNPath)
- return
- end if
- set browserPath to GetConfigHelper("application", "browser", hd & "mime.cfg")
- if (browserPath = EMPTY) or not netObj(mFileExist, browserPath) then
- set browserPath to LocalizeBrowser()
- end if
- if browserPath = EMPTY then
- return
- end if
- open(theDNPath, browserPath)
- end
-
- on LocalizeBrowser
- set browserPath to GetConfigHelper("application", "netscape", hd & "mime.cfg")
- if (browserPath <> EMPTY) and netObj(mFileExist, browserPath) then
- return browserPath
- end if
- set browserPath to netObj(mRegPath, "NetscapeMarkup\shell\open")
- set browserPath to char 1 to length(browserPath) - 3 of browserPath
- if (browserPath <> EMPTY) and netObj(mFileExist, browserPath) then
- return browserPath
- end if
- set alertString to "Questo articolo Ë in HTML." & RETURN
- set alertString to alertString & "Per favore trova il tuo browser HTML"
- set browserPath to AskApplication(alertString, "Browser HTML")
- if browserPath <> EMPTY then
- AddHelper("application", "browser", browserPath, hd & "mime.cfg")
- end if
- return browserPath
- end
-